package com.suray.wcs.service.wmsconnect;


import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @author shaozn
 * @date 2019-11-25 16:29
 * @describe gsonFormat 自动生成WMS任务接收接口类
 */
public class WmsTask implements Serializable {

    /**
     * groupId : id123
     * msgTime : 2020-07-14 02:51:33.379
     * priorityCode : 0
     * district : A_035
     * tasks : [{"barCode":"XZY000192","endNode":"MX0-12-23","startNode":" MX0-12-24","taskId":"ACD3491","taskType":0,"order":0},{"barCode":"XZY000192","district":"A_035","endNode":"MX0-12-23","startNode":" MX0-12-24","taskId":"ACD3491","taskType":0,"order":0}]
     */

    private String groupId;
    private String msgTime;
    private Integer priorityCode;
    /**
     * 库区district更改为warehouse
     * @data 2021-12-09
     */
    private String warehouse;
    private List<TasksBean> tasks;

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public String getMsgTime() {
        return msgTime;
    }

    public void setMsgTime(String msgTime) {
        this.msgTime = msgTime;
    }

    public Integer getPriorityCode() {
        return priorityCode;
    }

    public void setPriorityCode(Integer priorityCode) {
        this.priorityCode = priorityCode;
    }

    public String getWarehouse() {
        return warehouse;
    }

    public void setWarehouse(String warehouse) {
        this.warehouse = warehouse;
    }

    public List<TasksBean> getTasks() {
        return tasks;
    }

    public void setTasks(List<TasksBean> tasks) {
        this.tasks = tasks;
    }

    public static class TasksBean implements Comparable{
        /**
         * barCode : XZY000192
         * endNode : MX0-12-23
         * startNode :  MX0-12-24
         * taskId : ACD3491
         * taskType : 0
         * order : 0
         * district : A_035
         */

        private String barCode;
        private String endNode;
        private List<String> endNodes;
        private String startNode;
        private String taskId;
        private Integer taskType;
        private Integer order;
//        private String district;

        public String getBarCode() {
            return barCode;
        }

        public void setBarCode(String barCode) {
            this.barCode = barCode;
        }

        public String getEndNode() {
            return endNode;
        }

        public void setEndNode(String endNode) {
            this.endNode = endNode;
        }

        public List<String> getEndNodes() {
            return endNodes;
        }

        public void setEndNodes(List<String> endNodes) {
            this.endNodes = endNodes;
        }

        public String getStartNode() {
            return startNode;
        }

        public void setStartNode(String startNode) {
            this.startNode = startNode;
        }

        public String getTaskId() {
            return taskId;
        }

        public void setTaskId(String taskId) {
            this.taskId = taskId;
        }

        public Integer getTaskType() {
            return taskType;
        }

        public void setTaskType(Integer taskType) {
            this.taskType = taskType;
        }

        public Integer getOrder() {
            return order;
        }

        public void setOrder(Integer order) {
            this.order = order;
        }

//        public String getDistrict() {
//            return district;
//        }
//
//        public void setDistrict(String district) {
//            this.district = district;
//        }

        @Override
        public int compareTo(@NotNull Object o) {
            TasksBean tasksBean = (TasksBean) o;
            if(this.getOrder() > tasksBean.getOrder()){
                return 1;
            }
            return -1;
        }

        @Override
        public String toString() {
            return "TasksBean{" +
                    "barCode='" + barCode + '\'' +
                    ", endNode='" + endNode + '\'' +
                    ", startNode='" + startNode + '\'' +
                    ", taskId='" + taskId + '\'' +
                    ", taskType=" + taskType +
                    ", order=" + order +
//                    ", district='" + district + '\'' +
                    '}';
        }
    }

    @Override
    public String toString() {
        return "WmsTask{" +
                "groupId='" + groupId + '\'' +
                ", msgTime='" + msgTime + '\'' +
                ", priorityCode=" + priorityCode +
                ", wareHouse='" + warehouse + '\'' +
                ", tasks=" + tasks +
                '}';
    }
}

